<style>
.clear{clear:both;}
.sortmenu_sort{
    width: 100%;
    max-height: 10rem;
    background-color: #fff;
    z-index: 100000;
    position: absolute;
    top: 2rem;
    left: 0;
    border-radius: 0 0 0.2rem 0.2rem;
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
    overflow: auto;
}
.sortmenu_sort h1{
    color: #ec660f;
    font-size: 0.7rem;
    border-bottom: 1px solid #ec660f;
    padding:0 0.5rem;
    line-height: 1.5rem;
}
.sortmenu_sort li {
    list-style: none;
    line-height: 2rem;
	color:{{main.syscolor ||'#18bc9c'}};
    text-align: left;
    padding:0 0.5rem;
    font-size:0.65rem;
    border-bottom: 1px solid #d8d8d8;
}
.store-star .star {
    color: #666;
	font-size:0.6rem;
}

.store-star .star span {
    padding: 0;
    margin: 0
}

.store-star .star .shine {
    color: #fa672d;
}
.store-star .star .star1 {
    /*clear: both*/
}
.BMap_Marker img{border-radius:50%;width:36px;height:36px; box-shadow: 5px 10px 10px rgba(0, 0, 0, 0.5);}
</style>
<div ng-if="pagedata.op=='main'" class="fui-page page-goods-list" >
	<div class="fui-content">
		<div id="allmap" style="height: 11rem;padding:0px 0px;"></div>
		<div class="sort" style="top:0">
			<div class="item on" style="width:2%" ng-click="toogle(pagedata,'showpaixu')"><span class='text'>{{pagedata.ordertitle||'按距离排序'}}</span> <i ng-if="!pagedata.showpaixu" class="icon jinyunicon icon-moreunfold"></i> <i ng-if="pagedata.showpaixu" class="icon jinyunicon icon-less"></i></div>
			<div ng-class="{'item':1,'on':pagedata.params.type==2}" ng-click="pagedata.selectget(2,pagedata.params.order)"><span class='text'>专线</span></div>
			<div ng-class="{'item':1,'on':pagedata.params.type==1}" ng-click="pagedata.selectget(1,pagedata.params.order)"><span class='text'>车主</span></div>
			<!--<div ng-class="{'item':1,'on':pagedata.params.status==3}" ng-click="pagedata.selectget(3,pagedata.params.order)"><span class='text'>代理商</span></div>-->
			<div class="sortmenu_sort" ng-if="pagedata.showpaixu">
				 <ul>
					   <li ng-click="pagedata.showpaixu=false;pagedata.ordertitle='按距离排序';pagedata.selectget(pagedata.params.type,'default')">按距离排序 <i ng-if="pagedata.params.order=='default'" class="icon icon-selected" style="font-size:1rem;float:right;{{main.syscolor ||'#18bc9c'}}"></i></li>
					   <li ng-click="pagedata.showpaixu=false;pagedata.ordertitle='按星级排序';pagedata.selectget(pagedata.params.type,'star')">按星级排序 <i ng-if="pagedata.params.order=='star'" class="icon icon-selected" style="font-size:1rem;float:right;{{main.syscolor ||'#18bc9c'}}"></i></li>
					   <li ng-click="pagedata.showpaixu=false;pagedata.ordertitle='按接货量排序';pagedata.selectget(pagedata.params.type,'sales')">按接货量排序 <i ng-if="pagedata.params.order=='sales'" class="icon icon-selected" style="font-size:1rem;float:right;{{main.syscolor ||'#18bc9c'}}"></i></li>
					   <li ng-click="pagedata.showpaixu=false;pagedata.ordertitle='按浏览量排序';pagedata.selectget(pagedata.params.type,'looks')">按浏览量排序 <i ng-if="pagedata.params.order=='looks'" class="icon icon-selected" style="font-size:1rem;float:right;{{main.syscolor ||'#18bc9c'}}"></i></li>
				 </ul>
			</div>
		</div>
		<div ng-if="pagedata.list.length>0" class="fui-list-group merchgroup" style="background:none;padding:0 0.5rem" ng-repeat="item in pagedata.list">
            <div class="fui-list" style="background:#fff;border-radius:0.5rem;">
                <a class="fui-list-media storelogo" href="javascript:;" ng-click="access_json('jy_wuliu/merch/detail/id='+item.id)">
                    <div style="width:100%;text-align:center">
						<div style="width:3rem;margin:0 auto"><img class="round" style="border-radius:50%;height:3rem;width:3rem" ng-src="{{tomedia(item.logo) || '../core/resource/images/nopic.jpg'}}"></div>
						<div class="jylabel jylabel-primary active" style="border-radius:2rem;margin-top:0.3rem;font-size:0.6rem;border: 1px solid {{main.syscolor ||'#18bc9c'}};background-color:{{main.syscolor ||'#18bc9c'}};width:100%">{{item.typetitle}}</div>
					</div>
                </a>
                <a class="fui-list-inner" style="margin-top:0.16rem" href="javascript:;" ng-click="access_json('jy_wuliu/merch/detail/id='+item.id)">
                    <div class="title" style="font-size:0.7rem">{{item.title}} <i ng-if="item.sex!=1" class="icon icon-nv"></i><i ng-if="item.sex==1" class="icon icon-nan"></i></div>
                    <div class="store-star" style="border-bottom: 1px solid #f1f1f1;font-size:0.65rem">
						<span class="star star1">
									<span ng-class="{'shine':item.stars >= 1}"><i class="icon icon-shoucang-tianchong"></i></span>
									<span ng-class="{'shine':item.stars >= 2}"><i class="icon icon-shoucang-tianchong"></i></span>
									<span ng-class="{'shine':item.stars >= 3}"><i class="icon icon-shoucang-tianchong"></i></span>
									<span ng-class="{'shine':item.stars >= 4}"><i class="icon icon-shoucang-tianchong"></i></span>
									<span ng-class="{'shine':item.stars >= 5}"><i class="icon icon-shoucang-tianchong"></i></span>
						</span>
						<span class="r-f"><span style="margin-right:0.3rem"><span class="syscolor">{{item.jielis ||'0'}}</span>单</span><span class="r">围观：{{item.looks ||'0'}}</span></span>
					</div>
					<div class="title" style="margin-top:0.3rem;height:auto;">
						<span ng-repeat="t in item.xianlus" class="jylabels jylabel-gray" style="margin:0.2rem;border: 1px solid #666;color:#666;border-radius:0.2rem;line-height:0.8rem;padding: 0.1rem 0.3rem;">{{t.fromcity}}&#8644{{t.tocity}}</span>
					</div>
					<div class="subtitle" style="padding-top:0.3rem;font-size:0.55rem">
						<div class="store-moneylimit syscolor r">
							<i class="icon icon-map"></i> {{item.juli || 2.1}}KM
						</div>
					</div>
                </a>
            </div>
		</div>
		<div ng-show="pagedata.loading" class='infinite-loading'><span class='fui-preloader'></span><span style="margin-left:1.5rem"> 正在加载...</span></div>
	</div>
</div>
<div class="fui-page" ng-if="pagedata.op == 'detail'">
<div class="fui-content">
		<div class="fe-mod-9" style="height:12rem;min-height:6rem">
			<div id="l-map" style="height: 12rem;padding:0px 0px;"></div>
			<div class="group-top" style="background:rgba(0,0,0,0.3);position: absolute;top:4.8rem;height:7.2rem;width:100%">
			 <div class="fui-list jump text-center">
				  <a class="fui-list-inner">
					 <div class="title c" style="color: #fff;margin:0.8rem 0 0.3rem 0">{{pagedata.item.title}}</div>
					 <div class="subtitle" style="color: #fff;font-size:0.55rem">已服务：{{pagedata.item.jielis || 0}}次 | 围观人数：{{pagedata.item.looks || 0}}</div>
					 <div class="subtitle" style="color: #fff;font-size:0.5rem">{{pagedata.item.desc}}</div>
				   </a>
			  </div>
			</div>
			<div class="fe-mod-9-shoplogo" style="top:2rem"> 
				<div class="fe-mod-9-shoplogo-img" style="">
					<img src="{{tomedia(pagedata.item.logo) || '../core/resource/images/nopic.jpg'}}">
				</div>
			</div>
		</div>
		<div ng-if="pagedata.item.images.length>0" id="carousel-container" class="carousel slide"  style="position:absolute;top:9.3rem;width:80%;left:10%;border-radius:0.5rem" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="height:5rem">
				<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.item.images" style="height:5rem">
					<a href="javascript:;">
						<img src="{{tomedia(item) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;border-radius:0.5rem">
					</a>
				</div>
			</div>
			<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="item in pagedata.item.images" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
		</div>
		<div class="weui_cells weui_cells_form" style="margin-top:2.8rem">
				 <a class="weui_cell" ng-click="pagedata.openLocation(pagedata.item);">
					<div class="weui_cell_hd"><i class="icon jinyunicon icon-ditu" style="font-size:0.9rem"></i></div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>所在地址：{{pagedata.item.address || '无'}}</span>
					</div>
					<div class="weui_cell_ft">
					</div>
				</a>
				<a class="weui_cell" href="tel:{{pagedata.item.mobile}}">
					<div class="weui_cell_hd"><i class="icon jinyunicon icon-phone" style="font-size:0.9rem"></i></div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>电话：{{pagedata.item.mobile || '无'}}</span>
					</div>
					<div class="weui_cell_ft">
					</div>
				</a>
				<div class="weui_cells_title" style="padding-left:0">商户描述</div>
				<div class="weui_cell">
					<div class="weui_cell desc">
						{{pagedata.item.desc || '该商户暂无描述！'}}
					 </div>
				</div>
				<div class="weui_cells_title" style="padding-left:0">线路详情</div>
				<div class="weui_cell">
					<span ng-repeat="t in pagedata.item.xianlus" class="jylabels jylabel-gray" style="margin:0.2rem;border: 1px solid #666;color:#666;border-radius:0.2rem;line-height:0.8rem;padding: 0.1rem 0.3rem;">{{t.fromcity}}&#8644{{t.tocity}}</span>
				</div>
				<div class="weui_cells_title" style="padding-left:0">价格详情</div>
				<div class="weui_cell">
					<div class="weui_cell_hd"><i class="icon icon-jifen"></i> 重货价格</div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>纯重{{pagedata.item.wprice1 || 0}}元/吨</span><span style="margin-left:0.5rem">重货{{pagedata.item.wprice2 || 0}}元/吨</span>
					</div>
				</div>
				<div class="weui_cell">
					<div class="weui_cell_hd"><i class="icon icon-biaochi"></i> 轻货价格</div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>纯抛{{pagedata.item.wprice1 || 0}}元/方</span><span style="margin-left:0.5rem">重抛{{pagedata.item.wprice2 || 0}}元/方</span>
					</div>
				</div>
				<div class="weui_cell">
					<div class="weui_cell_hd"><i class="icon icon-machinery"></i> 机械价格</div>
					<div class="weui_cell_bd weui_cell_primary">
						<span>{{pagedata.item.jprice || 0}}元/吨</span>
					</div>
				</div>
        </div>
		
</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
  // 百度地图API功能
if(scope.pagedata.op=='main'){
	window.scope.location(function(res){
		if(!scope.pagedata.pcd.city){
				scope.pagedata.pcd.province = res.addressComponents.province;
				scope.pagedata.pcd.city = res.addressComponents.city;
		}
		scope.pagedata.pcd.lat = res.lat_lng.lat;
		scope.pagedata.pcd.lng = res.lat_lng.lng;
		scope.tool.get_list('jy_wuliu/merch/getlist/lat='+scope.pagedata.pcd.lat+'&lng='+scope.pagedata.pcd.lng,true,function(res){
			require(['map'], function(BMap){
				var map = new BMap.Map("allmap");
				var list=scope.pagedata.list;
				var first=scope.pagedata.list[0];
				if(first){
					var point = new BMap.Point(first['lat_lng']['lng'], first['lat_lng']['lat']);
				}else{
					var point = new BMap.Point(scope.pagedata.pcd['lng'], scope.pagedata.pcd['lat']);
				}
				map.centerAndZoom(point, 13.6);
				// 编写自定义函数,创建标注
				function addMarker(point,icon){
				  var marker = new BMap.Marker(point);
				  var icon=new BMap.Icon(icon,new BMap.Size(50,50));
				  marker.setIcon(icon);
				  map.addOverlay(marker);
				}
				for (var i = 0; i < list.length; i ++) {
					var point = new BMap.Point(list[i]['lat_lng']['lng'], list[i]['lat_lng']['lat']);
					addMarker(point,list[i].logo);
				}
			});
		});
	});
	
	scope.pagedata.scroll_bottom=function(){
		scope.tool.get_list('jy_wuliu/merch/getlist/lat='+scope.pagedata.pcd.lat+'&lng='+scope.pagedata.pcd.lng);
	}
	scope.pagedata.selectget=function(type,order){
		order=order?order:'';
		type=type?type:'';
		scope.pagedata.params.type=type;
		scope.pagedata.params.order=order;
		scope.tool.get_list('jy_wuliu/merch/getlist/lat='+scope.pagedata.pcd.lat+'&lng='+scope.pagedata.pcd.lng+'&order='+order+'&type='+type,true);
	}
}
scope.pagedata.openLocation=function(item){
	wx.openLocation({
	latitude: item.lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
	longitude: item.lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
		name: item.province+item.city+item.district, // 位置名
		address: item.address, // 地址详情说明
		scale: 20, // 地图缩放级别,整形值,范围从1~28。默认为最大
		infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
		success:function(){
			//alert(1111);
		}
	});
}
if(scope.pagedata.op!='main'){
	// 百度地图API功能
	require(['map'], function(BMap){
		var map = new BMap.Map("l-map");
		var lng=scope.pagedata.item.lat_lng.lng ? scope.pagedata.item.lat_lng.lng : '113.941134';
		var lat=scope.pagedata.item.lat_lng.lat ? scope.pagedata.item.lat_lng.lat : '22.546011';
		var point = new BMap.Point(lng, lat);
		map.centerAndZoom(point, 15);
		// 编写自定义函数,创建标注
		function addMarker(point){
		  var marker = new BMap.Marker(point);
		  map.addOverlay(marker);
		}
		addMarker(point);
	});
}
</script>
<script>
	require(['bootstrap', 'hammer'], function($, Hammer){
		$('#carousel-container').carousel();
		var mc = new Hammer($('#carousel-container').get(0));
		mc.on("panleft", function(ev) {
			$('#carousel-container').carousel('next');
		});
		mc.on("panright", function(ev) {
			$('#carousel-container').carousel('prev');
		});
	});
</script>